home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1997 September
/
Macworld (1997-09).dmg
/
Serious Software
/
Cherwell Scientific Demos
/
pro Fit
/
pro Fit 5.0 demo (fpu).sea
/
pro Fit 5.0 demo (fpu)
/
External Modules
/
External modules sources
/
Pascal
/
Multiply.p
< prev
next >
Wrap
Text File
|
1996-04-21
|
4KB
|
142 lines
{************************************************************************************}
{ Multiply.c }
{ }
{ }
{ Version 26.9.94 }
{************************************************************************************}
unit user;
interface
{$IFC UNDEFINED THINK_PASCAL }
uses
Types, fp, proFit_interface;
{$ELSEC}
uses
proFit_interface;
{$ENDC}
{$MAIN}
{ this directive tells the compiler that the next routine is the main entry }
procedure main (selector: integer; pb: ExtModulesParamBlockPtr);
implementation
{ note: MPW users must make sure that the procedure main is at the beginning of the compiled code }
{ under Think Pascal, this is cared for by the compiler }
{ We let main call a function mainMain to make sure that the code starts with a jump to }
{ our entry point even when compiling under MPW Pascal }
procedure mainMain (selector: integer; pb: ExtModulesParamBlockPtr);
forward;
procedure main (selector: integer; pb: ExtModulesParamBlockPtr);
begin
mainMain(selector, pb);
end;
{************************************************************************************}
procedure SetUp (var moduleKind: integer; { set moduleKind to isFunction or isProgram }
var name: Str255; { the name of the program or function }
var requiredGlobals: longint; { the number of bytes to be allocated in ExtModulesParamBlock.globals }
{ set requiredGlobals to 0 if you don't use this feature }
pb: ExtModulesParamBlockPtr); { the complete parameter block passed by pro Fit to the }
{ routines defined in this file. In most cases it can be ignored }
{ SetUp is called once when the external module is linked to pro Fit }
begin
moduleKind := isProgram;
name := 'Multiplication Table';
requiredGlobals := 0;
end;
{************************************************************************************}
procedure InitializeProg (pb: ExtModulesParamBlockPtr);
{ Can be left emtpy if not needed. }
{ called when the external module is linked to proFit after SetUp was called }
{ can be used to inititialize global variables, etc. }
begin
end;
{************************************************************************************}
procedure Run (pb: ExtModulesParamBlockPtr);
{ pro Fit calls this function when the name of the program is chosen from the }
{ Run Program submenu in the menu Calc }
var
i, j: integer;
begin
for i := 1 to nrRows do
for j := 1 to nrCols do
SetData(i, j, i * j);
end;
{************************************************************************************}
procedure CleanUp (pb: ExtModulesParamBlockPtr);
{ called when the function or program is removed from pro Fit's menus }
{ in most cases, this function can be empty }
begin
end;
{***********************************************************************************************}
{ This is the main procedure through which all calls to the external module go. }
{ Main takes care of calling the right procedure with the right parameters depending on }
{ the value of "selector". }
{ You don't need to touch this procedure }
procedure mainMain (selector: integer; pb: ExtModulesParamBlockPtr);
{$IFC NOT UNDEFINED SET_A4}
var
oldA4: longint;
{$ENDC}
begin
{$IFC NOT UNDEFINED SET_A4}
oldA4 := SetCurrentA4;
{$ENDC}
Startup(pb);
case selector of
kSetup:
begin
pb^.requiredGlobals := 0;
pb^.versionNumber := VERSIONNUMBER;
if sizeof(extended) = 10 then
pb^.codeType := CPU68noFPU
else if sizeof(extended) = 12 then
pb^.codeType := CPU68FPU
else
pb^.codeType := CPUPowerPC;
SetUp(pb^.moduleKind, pb^.name, pb^.requiredGlobals, pb);
end;
progInitialize:
InitializeProg(pb);
progRun:
Run(pb);
kCleanUp:
CleanUp(pb);
otherwise
end;
{$IFC NOT UNDEFINED SET_A4}
oldA4 := SetA4(oldA4);
{$ENDC}
end;
end.